<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>
<body>
    <div id="app">
        <div v-bind:class="colorClass">展示不同颜色</div>
        <!-- v-on:事件名="方法名" 
            简写   @事件名="方法名"
        -->
        <button v-on:click="changeColor('redColor')">红色</button>
        <button @click="changeColor('blueColor')">蓝色</button>
    </div>
    <script>
        new Vue({
            el: '#app',
            data: {
                colorClass: 'redColor'
            },
            methods: {
                changeColor (className) {
                    this.colorClass = className
                }
            }
        })
    </script>
    <style>
        .redColor{
            color: red;
        }
        .blueColor{
            color: blue;
        }
    </style>
</body>
</html>